﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Web;

/// <summary>
/// Summary description for ProBusCat
/// </summary>
public class ProBusCat
{
	public ProBusCat()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public DataSet LoadBusCat()
    {
        DataSet ds = new DataSet();
        ConnectDB db = new ConnectDB();
        ds = db.getBusCat();
        return ds;
    }

    public Boolean SaveBusCataloge(BusinessCataloge buscat)
    {
        Boolean bResult = false;
        ConnectDB db = new ConnectDB();
        bResult = db.saveBusCat(buscat);

        return bResult;
    }

    //true: exist; false: not exist
    public Boolean CheckBusCatExist(String nameofbuscat) 
    {
        Boolean result = false;
        ConnectDB db = new ConnectDB();
        DataSet ds = new DataSet();
        ds = db.checkExistBusCat(nameofbuscat);
        if (ds.Tables[0].Rows.Count == 0) 
            result = false;
        else 
            result = true;
        return result;
    }

    public Boolean DeleteBusCat(BusinessCataloge buscat)
    {
        ConnectDB db = new ConnectDB();
        Boolean bResult = db.deleteBusCataloge(buscat);
        return bResult;
    }

    public Boolean UpdateBusCat(BusinessCataloge buscat)
    {
        ConnectDB db = new ConnectDB();
        Boolean bResult = db.editBusCataloge(buscat);
        return bResult;
    }

}
